home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tool-inc.zip / SYSDATE2.INC < prev    next >
Text File  |  1989-06-02  |  1KB  |  67 lines

  1.  
  2. (*
  3.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  4.  *
  5.  * This is a component of the ProDoor System.
  6.  * Do not distribute modified versions without my permission.
  7.  * Do not remove or alter this notice or any other copyright notice.
  8.  * If you use this in your own program you must distribute source code.
  9.  * Do not use any of this in a commercial product.
  10.  *
  11.  *)
  12.  
  13. (*
  14.  * sysdate2 - library to return system date and time,
  15.  *            version2 with different return formats. (3-1-89)
  16.  *
  17.  *)
  18.  
  19. function strval (i: integer): string2;
  20. begin
  21.    strval := chr(((i div 10) mod 10) + ord('0')) +
  22.              chr((i mod 10) + ord('0'));
  23. end;
  24.  
  25. function system_dd: string2;
  26. var
  27.    reg:           registers;
  28. begin
  29.    reg.ax := $2a00;
  30.    msdos(reg);
  31.    system_dd := strval(lo(reg.dx));
  32. end;
  33.  
  34. function system_mm: string2;
  35. var
  36.    reg:           registers;
  37. begin
  38.    reg.ax := $2a00;
  39.    msdos(reg);
  40.    system_mm := strval(hi(reg.dx));
  41. end;
  42.  
  43. function system_yy: string2;
  44. var
  45.    reg:           registers;
  46. begin
  47.    reg.ax := $2a00;
  48.    msdos(reg);
  49.    system_yy := strval(reg.cx-1900);
  50. end;
  51.  
  52. function system_date: string8;   {format: mm-dd-yy}
  53. begin
  54.    system_date := system_mm + '-' + system_dd + '-' + system_yy;
  55. end;
  56.  
  57.  
  58. function system_time: string8;   {format: hh:mm}
  59. var
  60.    reg:       registers;
  61. begin
  62.    reg.ax := $2c00;
  63.    msdos(reg);
  64.    system_time := strval(hi(reg.cx)) +  ':' + strval(lo(reg.cx));
  65. end;
  66.  
  67.